﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Guarantors.aspx.cs" Inherits="Guarantors" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<asp:Content ID="ClassifiersContnet" ContentPlaceHolderID="MainContent" Runat="Server">

    <asp:UpdatePanel runat="server">
        <ContentTemplate>    

            <asp:Panel ID="emptyPanel" runat="server" visible="false">
                <div align="center">
                    <h1>Guarantors list</h1>
                </div>
            </asp:Panel>

            <asp:Panel ID="allListPanel" runat="server" Visible="False">
                <asp:Button ID="newButton" runat="server" Text="Adauga nou" Width="230px"  onclick="newButton_Click">
                </asp:Button>
                <hr />
                <asp:GridView ID="listGridView" runat="server" 
                        EnableModelValidation="True" 
                        AutoGenerateColumns="False" 
                        CssClass="mGrid"
                        PagerStyle-CssClass="pgr"
                        AlternatingRowStyle-CssClass="alt"
                        AllowPaging="True"         
                        PageSize="10" 
                        onrowediting="listGridView_RowEditing" 
                        onpageindexchanging="listGridView_PageIndexChanging" 
                        onrowdeleting="listGridView_RowDeleting" >
                    <Columns>
                        <asp:BoundField DataField="GuarantorsID"       HeaderText="GuarantorsID"          HtmlEncode="False"   HeaderStyle-CssClass="HiddenColumn" ItemStyle-CssClass = "HiddenColumn"  />
                        <asp:BoundField DataField="Name"          HeaderText="Name"             HtmlEncode="False" />
                        <asp:BoundField DataField="TaraID"    HeaderText="TaraID"   HtmlEncode="false" HeaderStyle-CssClass="HiddenColumn" ItemStyle-CssClass = "HiddenColumn" />
                        <asp:BoundField DataField="tara_string" HeaderText="Tara" HtmlEncode="false" />
                        <asp:BoundField DataField="RaionID"    HeaderText="RaionID"   HtmlEncode="false" HeaderStyle-CssClass="HiddenColumn" ItemStyle-CssClass = "HiddenColumn" />
                        <asp:BoundField DataField="raion_string" HeaderText="Raion" HtmlEncode="false" />
                        <asp:BoundField DataField="Localitate"  HeaderText="Localitate" HtmlEncode="false" />
                        <asp:BoundField DataField="Address"  HeaderText="Address" HtmlEncode="false" />
                        <asp:BoundField DataField="PhoneFix"  HeaderText="PhoneFix" HtmlEncode="false" />
                        <asp:BoundField DataField="PhoneGSM"  HeaderText="PhoneGSM" HtmlEncode="false" />
                        <asp:BoundField DataField="JobID"  HeaderText="JobID" HtmlEncode="false" HeaderStyle-CssClass="HiddenColumn" ItemStyle-CssClass = "HiddenColumn"  />
                        <asp:BoundField DataField="job_String" HeaderText="Job" HtmlEncode="false" />
                        <asp:BoundField DataField="SurseVenitID"  HeaderText="SurseVenitID" HtmlEncode="false" HeaderStyle-CssClass="HiddenColumn" ItemStyle-CssClass = "HiddenColumn" />
                        <asp:BoundField DataField="sursevenit_string" HeaderText="Surse de venit" HtmlEncode="false" />
                        <asp:BoundField DataField="VenitLunar"  HeaderText="VenitLunar" HtmlEncode="false" />

                        <asp:ButtonField ButtonType="Button" CommandName="Edit" Text="Edit" />
                        <asp:TemplateField HeaderText="Delete">
                            <ItemTemplate>
                                    <asp:Button ID="deleteButton" runat="server" CommandName="Delete" Text="Delete" OnClientClick="return confirm('Sunteti sigur ca vreti sa stergeti?');" />
                            </ItemTemplate>
                        </asp:TemplateField>  
                    </Columns>
                </asp:GridView>
            </asp:Panel>

            <asp:Panel ID="addNewEntryPanel" runat="server" Visible="False" >
                <div class="module">
                    <div class="moduleHeader">Nou</div>
                    <div class="module_content">   
                        <p>
                            <label>Nume: </label>
                            <asp:TextBox ID="addNewTextBox" runat="server"></asp:TextBox>
                        </p>
                        <asp:UpdatePanel runat="server">
                            <ContentTemplate>
                                <p>
                                    <label>Tara: </label>
                                    <asp:DropDownList ID="addNewTaraDropDownList" runat="server" AutoPostBack="true" OnSelectedIndexChanged="addNewTaraDropDownList_SelectedIndexChanged"></asp:DropDownList>
                                </p>
                                <p>
                                    <label>Raion: </label>
                                    <asp:DropDownList ID="addNewRaionDropDownList" runat="server"></asp:DropDownList>
                                </p>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                        <p>
                            <label>Localitate: </label>
                            <asp:TextBox ID="addNewLocalitateTextBox" runat="server"></asp:TextBox>
                        </p>
                        <p>
                            <label>Address: </label>
                            <asp:TextBox ID="addNewAddressTextBox" runat="server"></asp:TextBox>
                        </p>
                        <p>
                            <label>Phone fix: </label>
                            <asp:TextBox ID="addNewPhoneFixTextBox" runat="server"></asp:TextBox>
                        </p>
                        <p>
                            <label>Phone GSM: </label>
                            <asp:TextBox ID="addNewPhoneGsmTextBox" runat="server"></asp:TextBox>
                        </p>
                         <p>
                            <label>Job: </label>
                            <asp:DropDownList ID="addNewJobDropDownList" runat="server"></asp:DropDownList>
                        </p>
                         <p>
                            <label>Surse de venit: </label>
                            <asp:DropDownList ID="addNewSurseVenitDropDownList" runat="server"></asp:DropDownList>
                        </p>
                        <p>
                            <label>Venit lunar: </label>
                            <asp:TextBox ID="addNewVenitLunarTextBox" runat="server"></asp:TextBox>
                        </p>

                        <asp:Button ID="addNewSaveButton"  runat="server" Text="Save" onclick="addNewSaveButton_Click"   />
                        <asp:Button ID="addNewCancelButton" runat="server" Text="Cancel"  onclick="addNewCancelButton_Click"  />
                    </div>
                </div>
            </asp:Panel>

            <asp:Panel ID="editEntryPanel" runat="server" Visible="False">
                <div class="module">
                    <div class="moduleHeader">Modific</div>
                    <div class="module_content">   
                        <p>
                            <label> ID: </label>
                            <asp:Label ID="guarantorsIDLabel" runat="server" Text="entry ID: " ></asp:Label>
                        </p>
                        <p>
                            <label>Nume: </label>
                            <asp:TextBox ID="editNameTextBox" runat="server"></asp:TextBox>
                        </p>
                        <asp:UpdatePanel runat="server">
                            <ContentTemplate>
                                <p>
                                    <label>Tara: </label>
                                    <asp:DropDownList ID="editTaraDropDownList" runat="server" AutoPostBack="true" onselectedindexchanged="editTaraDropDownList_SelectedIndexChanged"></asp:DropDownList>
                                </p>
                                <p>
                                    <label>Raion: </label>
                                    <asp:DropDownList ID="editRaionDropDownList" runat="server"></asp:DropDownList>
                                </p>
                            </ContentTemplate>                
                        </asp:UpdatePanel>
                        <p>
                            <label>Localitate: </label>
                            <asp:TextBox ID="editLocalitateTextBox" runat="server"></asp:TextBox>
                        </p>
                        <p>
                            <label>Address: </label>
                            <asp:TextBox ID="editAddressTextBox" runat="server"></asp:TextBox>
                        </p>
                        <p>
                            <label>Phone fix: </label>
                            <asp:TextBox ID="editPhoneFixTextBox" runat="server"></asp:TextBox>
                        </p>
                        <p>
                            <label>Phone GSM: </label>
                            <asp:TextBox ID="editPhoneGSMTextBox" runat="server"></asp:TextBox>
                        </p>
                         <p>
                            <label>Job: </label>
                            <asp:DropDownList ID="editJobDropDownList" runat="server"></asp:DropDownList>
                        </p>
                         <p>
                            <label>Surse de venit: </label>
                            <asp:DropDownList ID="editSursaVenitDropDownList" runat="server"></asp:DropDownList>
                        </p>
                        <p>
                            <label>Venit lunar: </label>
                            <asp:TextBox ID="editVenitLunarTextBox" runat="server"></asp:TextBox>
                        </p>
                        <asp:Button ID="editSaveButton" runat="server" Text="Save" onclick="editSaveButton_Click"  />
                        <asp:Button ID="editCancelButton" runat="server" Text="Cancel" onclick="editCancelButton_Click"  />
                    </div>
                </div>
            </asp:Panel>
   
       </ContentTemplate>
    </asp:UpdatePanel>

</asp:Content>



